﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;

public partial class manage_channel_CreatLabel_ch_elist : NetCMS.Web.UI.ManagePage
{
    Channel rd = new Channel();
    protected void Page_Load(object sender, EventArgs e)
    {
        GetStyleList(this.gstyleID, 0, 0);
        string _dirdumm = NetCMS.Config.UIConfig.dirDumm;
        if (_dirdumm.Trim() != "") { _dirdumm = "/" + _dirdumm; }
        style_base.InnerHtml = NetCMS.Common.Public.getxmlstylelist("styleContent", _dirdumm + "/xml/cuslabeStyle/channelStyle.xml");
        style_class.InnerHtml = NetCMS.Common.Public.getxmlstylelist("styleContent1", _dirdumm + "/xml/cuslabeStyle/CHstyleclass.xml");
        style_special.InnerHtml = NetCMS.Common.Public.getxmlstylelist("DropDownList2", _dirdumm + "/xml/cuslabeStyle/CHstylespecial.xml");
        GetdStyleList(this.ChannelStyle);
        GetStyleClassList(this.StyleClassID); ;
    }

    protected void GetStyleClassList(DropDownList lst)
    {
        int ChID = int.Parse(Request.QueryString["ChID"]);
        IDataReader dr = rd.getStyleClassList(0, ChID);
        while (dr.Read())
        {
            ListItem it = new ListItem();
            it.Value = dr["id"].ToString();
            it.Text = dr["cName"].ToString();
            lst.Items.Add(it);
        }
        dr.Close();
    }

    protected void GetdStyleList(DropDownList lst)
    {
        int ChID = int.Parse(Request.QueryString["ChID"]);
        IDataReader dr = rd.GetDefineStyle(ChID);
        int i = 2;
        string iStr = string.Empty;
        while (dr.Read())
        {
            ListItem it = new ListItem();
            string stxt = string.Empty;
            it.Value = "{CH$" + dr["EName"].ToString() + "}";
            if (i < 10)
            {
                iStr = ("0" + i).ToString();
            }
            it.Text = iStr + "." + dr["CName"].ToString();
            lst.Items.Add(it);
            i++;
        }
        dr.Close();
    }

    protected void GetStyleList(DropDownList lst, int ParentID, int Layer)
    {
        IDataReader dr = rd.GetStyleListAll(int.Parse(Request.QueryString["ChID"]));
        while (dr.Read())
        {
            ListItem it = new ListItem();
            string stxt = "";
            it.Value = dr["ID"].ToString();
            it.Text = stxt + dr["styleName"].ToString();
            lst.Items.Add(it);
            //GetStyleList(lst, int.Parse(dr["ID"].ToString()), (Layer + 1));
        }
        dr.Close();
    }
}
